/**
 * function ListNode(val) {
    this.val = val
    this.next = null
}
example: 1->2->4 & 1->3->4
return:  1->1->2->3->4->4
 */
var mergeTwoLists = function (l1, l2) {
    let curr = new ListNode()
    let dummy = curr
    while (l1 !== null && l2 !== null) {
        if (l1.val < l2.val) {
            curr.next = l1
            l1 = l1.next
        } else {
            curr.next = l2
            l2 = l2.next
        }
        curr = curr.next
    }

    // 只剩下一个链表时直接添加即可
    if (l1 !== null) {
        curr.next = l1
    }
    if (l2 !== null) {
        curr.next = l2
    }

    return dummy.next
}
